package com.slipper.core.database;

import com.slipper.core.database.vo.FieldVO;
import com.slipper.core.database.vo.IndexVO;
import com.slipper.core.database.vo.TableVO;

import java.util.List;
import java.util.Map;

public interface IResolver {
    /**
     * 查询表总数SQL
     */
    String tableTotalSQL(String tableName);

    /**
     * 查询表及字段SQL
     */
    String tableListSQL(String tableName);

    /**
     * 查询表及字段SQL
     */
    String tableColumnListSQL(String ...tableNames);

    /**
     * 查询表索引SQL
     */
    String tableIndexSQL(String ...tableNames);

    /**
     * 查询表字体SQL
     */
    String columnSQL(String tableName);

    /**
     * 生成建表ddl
     */
    String[] createTableDDL(TableVO table);

    /**
     * 生成视图ddl
     */
    String[] createOrUpdateViewDDL(String viewName, String sql);

    /**
     * 删除表ddl
     */
    String dropTableDDL(String tableName);

    /**
     * 删除视图ddl
     */
    String dropViewDDL(String viewName);

    /**
     * 生成建字段ddl
     */
    String addFieldDDL(String tableName, FieldVO field);

    /**
     * 生成修改字段ddl
     */
    String[] modifyFieldDDL(String tableName, FieldVO newField, FieldVO oldField);

    /**
     * 生成创建索引ddl
     */
    String addIndexDDL(String tableName, IndexVO index);

    String dropIndexDDL(String tableName, String indexName);

    void parseTable(Map<String, TableVO> tableMap, List<Map<String, Object>> fieldList);

    void parseIndex(Map<String, TableVO> tableMap, List<Map<String, Object>> indexList);

    boolean isEqualsType(String dataType, String columnType);

    Map<String, String> getDataTypeMap();
}
